package aconcagua.measure

class NullUnit extends UnitBehavior {

	// accessing
	@Override
	public baseUnit() {
		return this;
	}

	@Override
	public denominator() {
		return this;
	}

	@Override
	public nameForMany() {
		return this.name();
	}

	@Override
	public nameForOne() {
		return "";
	}

	@Override
	public nothingAmount() {
		return 0;
	}

	@Override
	public numerator() {
		return this;
	}

	@Override
	public sign() {
		return this.getClass().defaultSign();
	}

	// arithmetic operations
	@Override
	public divideByUnit(aUnit) {
		return aUnit;
	}

	@Override
	public multiplyByUnit(aUnit) {
		return aUnit;
	}

	// arithmetic operations - private
	@Override
	protected divide(DividedUnit aUnit) {
		return aUnit.reciprocal();
	}
	
	@Override
	protected divide(MultipliedUnit aUnit) {
		return new DividedUnit(this, aUnit);
	}
	
	@Override
	protected divide(NullUnit aUnit) {
		return this;
	}
	
	@Override
	protected divide(SimpleUnit aUnit) {
		return new DividedUnit(this, aUnit);
	}
	
	@Override
	protected multiply(DividedUnit aUnit) {
		return aUnit;
	}
	
	@Override
	protected multiply(MultipliedUnit aUnit) {
		return aUnit;
	}
	
	@Override
	protected multiply(NullUnit aUnit) {
		return aUnit;
	}
	
	@Override
	protected multiply(SimpleUnit aUnit) {
		return aUnit;
	}

	// converting
	public convertAmountFromBaseUnit(aNumber) {
		return this.nothingAmount();
	}

	@Override
	public convertAmountToBaseUnit(aNumber) {
		return aNumber;
	}

	// converting - private
	@Override
	protected convertFromBaseUnit(aMeasure) {
		return aMeasure;
	}

	protected convertToBaseUnit(aMeasure) {
		return aMeasure;
	}

	@Override
	public with(aNumber) {
		return aNumber;
	}
}
